<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/3.5.22/vue.global.js"></script>
</head>
<body>
    <div id="app">
        <p id="num">{{ a }}</p> 
        <button id="add" @click="add">+</button>
        <button id="sub" @click="sub">-</button>
    </div>

    <script>
        const app = Vue.createApp({
            data() {
                return {
                    a: 1
                }
            },
            methods: {
                add() {
                    this.a++
                },
                sub() {
                    this.a--
                }
            }
        }).mount("#app")
    </script>
</body>
</html>